import axios from "axios";
export {
    Request
}
//请求类
function Request() {
    //获取valueArr
    this.getValueArr = function (data) {
        return data.inputs.map(function (item, index, array) {
            return item.value;
        })
    }
    //添加参数
    this.addParams = function (keyArr, valueArr) {
        console.log(keyArr)
        console.log(valueArr)
        let formdata = new FormData();
        valueArr.forEach((item, index, arr) => {
            formdata.append(keyArr[index], item)
        });
        console.log(formdata.get('username'))
        return formdata;
        
    },
        //发送请求
        this.send = function (method, url, params) {
            return axios[method](url, params)
        }
}
